#ifndef TCPCLIENTSOCKET_H
#define TCPCLIENTSOCKET_H

#include <QTcpSocket>
#include <QJsonDocument>
#include <QJsonObject>

#include <../common/message.h>

class TcpClientSocket : public QTcpSocket
{
    Q_OBJECT
private:
    QString userName;
public:
    TcpClientSocket(QObject *parent);
    QString getUserName() const;
    void setUserName(const QString &newUserName);
    Message* readMessage();
    void writeMsg(Message*);

signals:
    void dataReady(Message*, TcpClientSocket*);
    void disConnected(TcpClientSocket*);
    // void userLogin(QString, TcpClientSocket*);

protected slots:
    void dataReceived();
};

#endif // TCPCLIENTSOCKET_H
